package com.boot.consumer;

import com.alibaba.fastjson.JSONObject;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.common.message.MessageExt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;

public class BusinessRouter implements Callable<Map<String,Object>> {

	private Logger logger = LoggerFactory.getLogger(getClass());

	private DefaultMQPushConsumer defaultMQPushConsumer;

	private String topic;

	private MessageExt messageExt;

	public BusinessRouter(DefaultMQPushConsumer defaultMQPushConsumer, MessageExt messageExt, String topic) {
		this.defaultMQPushConsumer = defaultMQPushConsumer;
		this.messageExt = messageExt;
		this.topic = topic;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Map<String,Object> call() {
		logger.info("[RocketMessageConsumer] consume message:" + new String(messageExt.getBody()));
		Map<String,Object> map = new HashMap<>();
		map.put("STATUS", 0000);
		return map;
	}
}
